﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lswweb.Model;

namespace Lswweb.Domain.ResourceConfiguration
{
    public class ResourceMessage : ResourceBase<ExceptionType, ExceptionMessage>
    {
        public ResourceMessage(string filePath) : base(filePath) { }

        protected override KeyValuePair<ExceptionType, ExceptionMessage> GetPairByXmlNode(System.Xml.XmlNode node)
        {
            ExceptionType key = (ExceptionType)int.Parse(node.Attributes["id"].Value);
            string title = node.SelectSingleNode("Title").InnerText;
            string body = node.SelectSingleNode("Body").InnerXml;

            return new KeyValuePair<ExceptionType, ExceptionMessage>(key, new ExceptionMessage(key,title,body));
        }
    }
}
